Integrated methods of performing network switch functions

ABSTRACT

On-switch methods for enforcing a policy relating to one or more network switch resources, for detecting and mitigating a network anomaly, and for selectively filtering packets to an externally-accessible port, are provided. The methods may each be embodied as one or more rules held by one or more processor readable media, with one or more of the rules defining one or more conditions to be met by one or more usage-derived packet statistics, and one or more actions to be performed if the one or more conditions are met.

RELATED APPLICATION(S)

This application is related to U.S. patent application Ser. No. 11/116,950, entitled “Rule Structure for Performing Network Switch Functions,” which is filed concurrently herewith on the same date, and is incorporated herein by reference.

BACKGROUND

1. Field of the Invention

This invention relates generally to the fields of network switch policy management, network security, and network anomaly detection and mitigation, and, more specifically, to distributed, on-switch methods of enforcing network switch policies, promoting network security, or detecting and mitigating network anomalies, which methods may be embodied as one or more rules stored locally at the network switches.

2. Related Art

To handle network attacks, viruses or other network anomalies, current networks typically perform a filtering function, centralized at one or more gateway switches that function as gateways between various subnets of the network, whereby potentially problematic packets are identified and sent to a port accessible by a network administrator and/or external appliance. The network administrator/external appliance manually examines the packets, and then takes appropriate action. If the packets in fact represent a network attack, virus or other anomaly, the network administrator may respond by downloading suitable rules known as Access Control Lists (ACLs) to the gateway switches within the network, instructing them to ignore the potentially problematic packets on an ongoing basis.

As this approach is highly fragmented, involving as it does detection of a potentially problematic packet at the gateway switch, followed by inspection of the packet by a network administrator/external appliance, followed by downloading of suitable ACLs at these gateway switches denying access to these packets, there is often a long latency between the time the potentially problematic packets are identified at the gateway switches and the time an appropriate response is implemented. Because of this latency, even after being detected, a network attack may propagate itself throughout the entire network, disrupting or disabling significant portions, before a response can be implemented.

Moreover, as this approach is often centralized at one or more gateway switches, it is incapable of detecting or responding to internal attacks that originate within a particular subnet. And it cannot exploit useful information maintained at the edge, non-gateway switches of a subnet that could assist in detecting and responding to many forms of network attacks.

Nor is this approach easily scaleable with the number of network switches in the network or the amount of traffic handled. In fact, as this approach involves filtering all packets of a particular type or from a particular user to the network administrator or external appliance, even if the packets are valid and unassociated with a network anomaly, it frequently overloads the network administrator as the number of switches, nodes or traffic within a network increases.

Nor can current ACLs solve the problem as current ACLs are incapable of detecting and responding to network attacks with the necessary level of precision and dynamism. Consider, for example, the following ACL (named icmp) configured for the purpose of addressing the problem of network flooding of a certain type of packet (ICMP echo requests) originating from a particular subnet (10.203.134.0/24):

entry icmp {

-   -   IF {         -   source-address 10.203.134.0/24;         -   protocol icmp;         -   icmp-type echo-request;     -   } THEN {         -   mirror enable icmp;     -   }

}

As this ACL always mirrors ICMP echo requests from the particular subnet, it is triggered even when an ICMP echo flooding condition is not present, resulting in many valid ICMP requests being mirrored. Also, because it requires the network administrator or network appliances to sort through many valid ICMP echo requests, it has the potential of overloading the network administrator or external appliance. Further, because it always mirrors the ICMP requests, it is incapable of dynamically responding, such as permitting access to ICMP echo requests when a once-present flooding condition has abated.

Therefore, there is a need for a more integrated, rapid, dynamic, scaleable and integrated approach for enforcing a policy relating to one or more network switch resources and/or detecting and responding to one or more network attacks, viruses and other anomalies, and/or selectively filtering packets to an externally-accessible port.

SUMMARY

The invention provides a method, performed at or within a network switch, of enforcing a policy relating to one or more network switch resources, such as switch access or bandwidth. This method has three or more steps.

In the first step, the method updates one or more usage-derived packet statistics, such as a cumulative count of packet bytes received at the network switch from a particular user or transmitted from the network switch by a particular user.

In the second step, the method determines if one or more conditions are met, the one or more conditions comprising or including one or more conditions based on the one or more usage-derived packet statistics, such as whether the cumulative count of packet bytes received at the switch from the particular user or transmitted from the switch by a particular user exceeds a specified threshold.

In the third step, the method enforces the policy by performing one or more specified actions if the one or more conditions are met. For example, in this step, the method may deny the user further access to the switch if the cumulative count of packet bytes received so far at the switch from that user or transmitted from the switch by that user exceeds the specified threshold.

The invention also provides a method, performed at or within a network switch, of detecting and mitigating a network anomaly such as a network attack, virus or worm. This method has three or more steps.

In the first step, the method updates one or more usage-derived packet statistics, such as the rate at which packets of a certain type are received at or transmitted from the switch.

In the second step, the method detects a network anomaly responsive to the updating of the one or more usage-derived packet statistics. For example, in this step, the method may detect an anomalous packet flooding condition if the rate at which packets of a certain type received at or transmitted from the switch exceeds a specified threshold.

In the third step, if a network anomaly is detected, the method mitigates the anomaly by performing one or more actions. For example, in response to the detection of the foregoing packet flooding condition, the method may deny further access to such packets, at least until the flooding condition abates.

The invention further provides a method, performed at or within a network switch, of selectively filtering packets to an externally-accessible port. This method has four or more steps.

In the first step, one or more packets are received at or transmitted from the network switch.

In the second step, the method updates one or more usage-derived packet statistics responsive to the receipt or transmitting of the one or more packets. For example, in this step, the method might update the average size of ping-type packets received at or transmitted from the switch.

In the third step, the method determines if one or more conditions are met, the one or more conditions comprising or including one or more conditions based on the one or more usage-derived packet statistics. For example, in this step, the method might determine if the foregoing average ping-type packet size exceeds a specified threshold.

In the fourth step, the method mirrors or redirects the one or more packets to the externally-accessible port if the one or more specified conditions are met. For example, in this step, if the average ping-type packet size exceeds the specified threshold, indicating abnormally large ping-type packets and a potential network anomaly, the method might mirror the ping-type packets to a port accessible by a network administrator or external appliance, allowing the network administrator or external appliance to examine the packets to determine if in fact a network anomaly is present.

The invention further provides a system having one or more non-gateway switches interconnected to form a first subnet that is coupled to a second subnet through one or more gateway switches or servers. In this system, each of the one or more non-gateway switches includes a means for performing one or more of the foregoing methods.

Other systems, media, products, devices, methods, features and advantages of the invention will be or will become apparent to one with skill in the art upon examination of the following figures and detailed description. It is intended that all such additional systems, media, products, devices, methods, features and advantages be included within this description, be within the scope of the invention, and be protected by the accompanying claims.

BRIEF DESCRIPTION OF THE DRAWINGS

The components in the figures are not necessarily to scale, emphasis instead being placed upon illustrating the principles of the invention. In the figures, like reference numerals designate corresponding parts throughout the different views.

FIG. 1 is a flowchart of an embodiment of an on-switch method of enforcing a policy relating to one or more network switch resources.

FIG. 2 is a flowchart of an embodiment of an on-switch method of detecting and mitigating a network anomaly.

FIG. 3 is a flowchart of an embodiment of an on-switch method of selectively filtering packets to an externally-accessible switch port.

FIG. 4 illustrates an embodiment of one or more processor readable media holding one or more rules embodying any of the foregoing methods.

FIG. 5 is a block diagram of an embodiment of a system for performing one or more network switch functions, the system comprising the one or more processor readable media of FIG. 4 and one or more processors configured to access and execute the one or more rules held by the processor readable medium.

FIG. 6 is a block diagram of a system comprising one or more non-gateway network switches interconnected to form a first subnet that is coupled to one or more other subnets by one or more gateway switches or servers, one or more of the non-gateway switches including on-switch means for performing any of the methods of FIGS. 1-3.

DETAILED DESCRIPTION

As utilized herein, terms such as “about” and “substantially” and “near” are intended to allow some leeway in mathematical exactness to account for tolerances that are acceptable in the trade. Accordingly, any deviations upward or downward from the value modified by the terms “about” or “substantially” or “near” in the range of 1% to 20% should be considered to be explicitly within the scope of the stated value.

As used herein, the term “software” includes source code, assembly language code, binary code, firmware, macro-instructions, micro-instructions, rules such as ACLs for performing one or more network switch functions, or the like, or any combination of two or more of the foregoing.

The term “processor readable medium” refers to any medium capable of holding software accessible by a processor, including but not limited to RAM, ROM, EPROM, PROM, EEPROM, disk, floppy disk, hard disk, CD-ROM, DVD, or the like, or any combination of two or more of the foregoing.

The term “processor” refers to any device capable of executing one or more software instructions and includes, without limitation, a general- or special-purpose microprocessor, finite state machine, controller, computer, digital signal processor (DSP), or the like.

The term “logic” refers to implementations in hardware, software, or combinations of hardware and software.

The term “ASIC” refers to an application specific integrated circuit.

The term “usage-derived packet statistic” refers to any statistic derived from usage of a packet within a network. Examples include a cumulative count of the number of packets of a certain type or from a particular user that are received at or transmitted from a network switch, a cumulative count of the number of bytes of such packets received at or transmitted from a network switch, the rate at which such packets or packet bytes are received at or transmitted from a network switch, a ratio of such rates, and the like.

1. Methods of Enforcing Policies Relating to One or More Network Switch Resources

FIG. 1 illustrates an embodiment 100 of a method, performed at or within a network switch, of enforcing a policy relating to one or more network switch resources. In this embodiment, the method comprises three or more steps, identified respectively with numerals 102, 104 and 106.

Step 102 comprises updating one or more usage-derived packet statistics.

Step 104 comprises determining if one or more conditions are met, the one or more conditions comprising or including one or more conditions based on the one or more usage-derived packet statistics.

Step 106 comprises enforcing the policy by performing one or more predetermined actions if the one or more conditions are met.

In one implementation, the updating of the one or more usage-derived packet statistics occurs responsive to receipt of the one or more packets at the network switch or the transmission of the one or more packets from the network switch. Moreover, in this implementation, the method enforces the policy of denying further access to a user who has exhausted his quota of network switch resources (or permitting access but lowering the priority assigned to the user's packets) until the user renegotiates and pays or agrees to pay a higher price for additional access or restoring the original priority.

In one example of this implementation, as packets are received at the switch, the method maintains and updates a cumulative count of packets received from or transmitted by a particular user, a cumulative count of packet bytes received from or transmitted by a particular user, or the rate at which such packets or packet bytes are received at or transmitted from the switch. If the updated cumulative packet count, packet byte count, or rate exceeds a specified threshold, the method either denies the user further access, lowers the priority of packets from the user (such as by changing the QoS profile assigned to these packets), or sends a trap or logs a message to a server accessible by a network administrator alerting the network administrator to the situation. After the user agrees to pay a higher price for additional network access or to retain original priority, the method responds appropriately, such as by permitting the user further access, raising or restoring the priority assigned to the user's packets, or ceasing the sending of traps or logging of messages to the server accessible by the network administrator.

In a second implementation, the method enforces a user's quota only during business hours (9 AM-5 PM), denying a user exceeding his quota access during business hours, but allowing such a user access outside of business hours.

2. Methods of Detecting and Mitigating Network Anomalies

FIG. 2 illustrates an embodiment 200 of a method, performed within or at a network switch, of detecting and mitigating a network anomaly. In this embodiment, the method comprises three or more steps, steps 202, 204 and 206.

Step 202 comprises updating one or more usage-derived packet statistics.

Step 204 comprises detecting a network anomaly responsive to the updating of the one or more usage-derived packet statistics.

Step 206 comprises mitigating the anomaly (if one is detected) by performing one or more actions.

In one implementation, the one or more usage-derived packet statistics are updated responsive to the receipt of one or more packets at the switch or transmission of one or more packets from the switch. Moreover, in this implementation, a network anomaly, in the form of a network attack, virus or worm, is detected from the updated one or more usage-derived packet statistics.

In one example, the network anomaly is characterized by packet flooding or excessive traffic of a particular kind of packet, and the method maintains and monitors one or more usage-derived packet statistics relating to this particular kind of packet, such as a cumulative count of the number of packets of this particular type that are received at or transmitted from the network switch, a cumulative count of the number of bytes of packets of this particular type that are received at or transmitted from the switch, the rate at which such packets or packets bytes are received at or transmitted from the switch, or a ratio of such rates. The method compares the statistic with a threshold to determine if a packet flooding or excessive traffic condition is present. If so, the method performed one or more actions to mitigate the anomaly, such as, for example, by blocking packets of the particular type or having a particular source address from the network switch, disabling the particular switch port at which such packets are received or from which they are transmitted, or logging a message to a server accessible by a network administrator to alert him of the situation.

In a second example, packets characteristic of a particular network anomaly have a signature, and the method detects whether packets having this particular signature are received at or transmitted from the network switch. If so, the method performs one or more actions to mitigate the anomaly, such as by blocking access to packets having the signature, sending a trap to a server accessible by a network administrator alerting him of the situation, or mirroring these packets to a port accessible by a network administrator so that the network administrator can examine the packets and take appropriate action.

In a third example, the network anomaly comprises excessive utilization of a particular switch port, and the method monitors the rate at which packets are received at or transmitted from this particular port. If the rate exceeds a threshold, the method takes appropriate action to mitigate the anomaly, such as by disabling the port.

In a fourth example, the network anomaly is excessive email traffic, and the method monitors the rate at which such traffic is received at or transmitted from the network switch. If the rate exceeds a threshold, the method performs one or more actions to mitigate the anomaly, such as blocking access to the switch by further email traffic.

3. Methods of Selectively Filtering Packets to an Externally-Accessible Port

FIG. 3 illustrates an embodiment 300 of a method, performed at or within a network switch, of selectively filtering packets to an externally-accessible port. In this embodiment, the method comprises four or more steps, steps 302, 304, 306 and 308.

Step 302 comprises receiving one or more packets at the network switch or transmitting one or more packets from the network switch.

Step 304 comprises updating one or more usage-derived packet statistics responsive to the receipt or transmission of the one or more packets.

Step 306 comprises determining if one or more conditions are met, the one or more conditions comprising or including one or more conditions based on the one or more usage-derived packet statistics.

Step 308 comprises mirroring or redirecting the one or more packets to the port if the one or more conditions are met.

In one example of this method, responsive to the receipt of one or more packets at the network switch, or transmission of one or more packets from the network switch, the method updates a ratio of first and second rates, the first rate comprising a rate at which bytes of a certain type of packet are received at or transmitted from the switch, and the second rate is a rate of which the certain type of packets are received at or transmitted from the switch. The method then compares the updated ratio with a threshold. If the updated ratio exceeds the threshold condition, indicating a potential network anomaly, the method mirrors or redirects the one or more packets to an externally-accessible port, where they may be examined by a network administrator or external appliance.

In a second example, responsive to the receipt of one or more packets at a particular ingress port or VLAN of the network switch, or transmission of one or more packets from a particular egress port or VLAN of the network switch, the method updates a statistic comprising the rate at which such packets are received or transmitted. If the rate exceeds a threshold, indicating a potential network anomaly, the method mirrors or redirects the packets to an externally-accessible port.

In a third example, responsive to the receipt of one or more packets of a particular type at a network switch, the method updates a statistic comprising the rate at which such packets are received at or transmitted from the switch. If the rate exceeds a threshold, indicating a potential network anomaly, the method mirrors or redirects the one or more packets to the externally-accessible port.

4. Rules for Implementing the Foregoing Methods

FIG. 4 illustrates an embodiment of one or more processor readable media 400 holding one or more rules 402 a, 402 b, 402 c embodying any of the foregoing methods. One or more of the rules 402 a, 402 b, 402 c in this embodiment conform to a rule structure comprising a first specification 402 a(1), 402 b(1), 402 c(1) defining one or more conditions, the one or more conditions comprising or including one or more conditions to be met by one or more usage-derived packet statistics, and a second specification 402 a(2), 402 b(2), 402 c(2) defining one or more actions to be taken by the network switch if the one or more conditions are met.

In one implementation, the one or more rules are software rules, each of which conforms to a rule structure that may be represented by one or more IF THEN ELSE statements, each having the form:

IF {one or more conditions are met};

THEN {one or more actions to be taken if one or more conditions are met);

ELSE {one or more actions to be taken if one or more conditions unmet}.

In this implementation, the first specification is within the IF clause and defines the one or more conditions that are to be met, and the second specification is within the THEN clause and defines the one or more actions to be taken if the one or more conditions defined by the first specification are met. In addition, a third specification within the ELSE clause defines the one or more actions to be taken if the one or more conditions defined by the first specification are unmet.

In a second implementation, the one or more rules 402 a, 402 b, and 402 c build on and extend other rules based on matching conditions defined in terms of matching packet profiles, including matching data in the packet header. The following example illustrates such a rule, rule1, for incrementing a counter, counter1, when a packet destined for a particular subnet (having address 192.168.16.0/24 and port 2049) is encountered. This is followed by a second rule, rule2, that denies access by these packets to the network switch if the contents of counter1 exceed a threshold of 1,000,000:

entry rule1 {

-   -   IF {         -   destination-address 192.168.16.0/24;         -   destination-port 2049;     -   }         -   THEN {count counter1}

entry rule2 {

-   -   IF {count counter1>1000000}         -   THEN {deny rule1}

In one example of this second implementation, the rules based on matching packet profiles are software rules having the following format:

entry {<rule-name>} {

IF {

-   -   <match conditions>     -   }

THEN {

-   -   <action>;     -   <action-modifers>;     -   }

}

where <rule-name> is the name of the rule, and one or more of the specified <match conditions> involve data within the packet or packet header, such as but not limited to the following:

-   -   IP source address     -   IP destination address     -   IP protocol     -   IP TOS bits     -   a flag indicating whether the packet is fragmented     -   TCP or UDP source port     -   TCP or UDP destination port     -   TCP flags     -   IGMP message type     -   IGMP type     -   IGMP code     -   Ethernet packet type     -   Ethernet source MAC address     -   Ethernet destination MAC address

In this particular example, a “prefix” operator can be used to specify a match condition based on a prefix of a specified packet field rather than the entirety of the field, e.g., a prefix of the IP source and destination addresses, rather than the entirety of these addresses; a “number” operator can be used to define a match condition based on a packet field being equal to a particular numerical value, e.g., TCP or UDP source or destination port numbers being equal to a specified value; a “range” operator can be used to specify a match condition based on a packet field being within a range of numerical values; a “bit-field” operator can be used to define a match condition based on specific packet bits being equal to a particular value, e.g., TCP flags being equal to a particular value; and a “MAC-address” operator can be used to define a match condition based on the Ethernet source or destination (MAC) address of the packet.

Also in this particular example, the match conditions may involve one or more logical conditions such as == (equal to), != (not equal to), > (greater than), >= (greater than or equal to), < (less than), and <= (less than or equal to).

The <action> that may be specified includes “permit,” indicating that the packet is to be accepted and forwarded to its final destination, or “deny,” indicating that the packet is to be dropped and not further processed

The <action-modifiers> that may be specified include 1) count <countemame>, which indicates that a packet count of packets meeting the specified profile is maintained in <countername>, and is to be incremented when a packet meeting the specified profile is received at the one or more ports or VLANs to which the rule is applicable or transmitted from one or more such ports or VLANs; 2) qosprofile <QosProfileName>, which indicates that packets meeting the specified profile are to be assigned the specified QoS profile; and 3) Sample <N>, which indicates that incoming packets are to be statistically sampled by sending every Nth packet to a CPU or other processor accessible by a network administrator.

In this second implementation, the rules based on satisfying one or more usage-derived packet statistics are diverse. An example of this latter type of rule is a rule that specifies one or more actions to be taken if a cumulative packet count, equal to the cumulative count of a particular type of packet received at one or more ingress ports or VLANs or transmitted from one or more egress ports or VLANs, equals, is not equal to, exceeds, equals or exceeds, is less than, or is less than or equal to, a certain threshold value. The following illustrates the format of such a rule:

entry <rulename> {

-   -   IF {count <counterName> REL_OPER <countThreshold>;     -   period {interval};     -   hysteresis {hysteresis};     -   }     -   THEN {         -   <actionListIf>;     -   } ELSE {         -   {actionListElse};     -   }

}

where

<ruleName> is the rule name;

<counterName> is the name of a counter from which the cumulative packet count is obtained;

<counterThreshold> is the threshold that is compared to the counter contents;

REL_OPER is a relational operator, i.e., ==, !=, >, >=, <, or <=;

{interval} is an optional evaluation interval in seconds defining the time period over which the execution of the rule is repeated. For example, a value of 10 specifies that, every 10 seconds, the cumulative packet count (represented by the contents of <counterName>) are compared with the indicated threshold. If not specified, either a default value may be used or the execution of the rule performed once;

{hysteresis} is an optional hysteresis value. Once the logical expression within the IF statement is true, the new threshold is adjusted with the hysteresis value. For > and >=expressions, the new threshold becomes (<countThreshold>−{hysteresis}). For < and <= expressions, the new threshold becomes (<countThreshold>+{hysteresis}). If {hysteresis} is greater than <countThreshold>, {hysteresis} is set to zero;

<actionListIf> is a list of one or more actions to be performed if the logical expression forming the subject of the IF statement is logically true; and

<actionListElse> is an optional list of one or more actions to be performed if the logical expression forming the subject of the IF statement is logically false.

In the following example of this particular rule format, the counter counter1 is incremented whenever a packet destined for a particular subnet (destination address 192.168.16.0/24, port 2049) is received or transmitted. The contents of the counter are evaluated every 10 seconds. If the value of counter1 is greater than 1,000,000 packets, a trap message is sent to the snmp server to alert the network administrator, and the packets are denied access to the network switch.

entry rule1 {

-   -   IF {         -   destination-address 192.168.16.0/24;         -   destination-port 2049;         -   protocol tcp;     -   } THEN {         -   count counter1;     -   }

}

entry count_rule_example {

-   -   IF {count counter1>1000000;         -   period 10;         -   }         -   THEN {             -   snmptrap 123 “Traffic on rule1 exceeds threshold”; #                 Send a single trap             -   deny rule1; # Action converts the rule rule1 to a “deny”                 rule.         -   }

}

Another example is a rule that specifies one or more actions to be taken if a packet rate, equal to the rate at which a particular packet type is received at one or more ingress ports or VLANs, equals or transmitted from one or more egress ports or VLANs, is not equal to, exceeds, equals or exceeds, is less than, or is less than or equal to, a certain threshold value. The following illustrates the format of such a rule:

entry <rulename> {

-   -   IF {delta <counterName> REL_OPER <countThreshold>;     -   period {interval};     -   hysteresis {hysteresis};     -   }     -   THEN {         -   <actionListIf>;     -   } ELSE {         -   {actionListElse};     -   }

}

where

<ruleName> is the rule name;

<counterName> is the name of a counter from which the change in cumulative packet count is derived since the last execution of the rule;

<counterThreshold> is the threshold that is compared to the change in counter contents;

REL_OPER is a relational operator, i.e., ==, !=, >, >=, <, or <=;

{interval} is an optional evaluation interval in seconds defining the time period over which the execution of the rule is repeated. For example, a value of 10 specifies that, every 10 seconds, the change in the cumulative packet count (represented by change in the contents of <counterName> since the last execution of the rule) are compared with the indicated threshold. If not specified, either a default value may be used or the execution of the rule performed once;

{hysteresis} is an optional hysteresis value. Once the logical expression within the IF statement is true, the new threshold is adjusted with the hysteresis value. For > and >= expressions, the new threshold becomes (<countThreshold>−{hysteresis}). For < and <= expressions, the new threshold becomes (<countThreshold>+{hysteresis}). If {hysteresis} is greater than <countThreshold>, {hysteresis} is set to zero;

<actionListIf> is a list of one or more actions to be performed if the logical expression forming the subject of the IF statement is logically true; and

<actionListElse> is an optional list of one or more actions to be performed if the logical expression forming the subject of the IF statement is logically false.

In the following example of this particular rule format, the counter counter1 is incremented whenever a packet destined for a particular subnet (destination address 192.168.16.0/24, port 2049, protocol TCP) is encountered (received or transmitted). The contents are the counter are evaluated every 10 seconds. If the delta (change) of the counter1 value over the last 10 seconds is greater or equal than 1,000 packets, a trap message is sent to the snmp server to alert the network administrator, and the QoS profile assigned to the packets is changed to reflect a lower priority status. If the delta value continues to exceed 1,000 packets, a trap message is sent to the snmp server every 120 seconds. Once the delta value falls below 1,000 packets, another message is to the snmp server indicating this, and the QoS profile assigned to the packets is restored to reflect the original priority status.

entry rule1 {

-   -   IF {         -   destination-address 192.168.16.0/24;         -   destination-port 2049;         -   protocol tcp;     -   } THEN {         -   count counter1;     -   }

}

entry delta_rule_example {

-   -   IF {delta counter1>=1000;}         -   THEN {             -   snmptrap 123 “Traffic to 192.168.16.0/24 exceed rate                 limit” 120; # One every 120 seconds             -   qosprofile rule1 QP3; # Move traffic to QP3         -   } ELSE {             -   snmptrap 123 “Traffic to 192.168.16.0/24 falls below                 rate limit”;         -   qosprofile rule1 QP1; # restore traffic to default qos             profile         -   }

}

A third example is a rule that specifies one or more actions to be taken if a ratio of cumulative packet counts, each comprising a cumulative count at which a particular type of packet is received at one or more ingress ports or VLANs or transmitted from one or more egress ports or VLANs, equals, does not equal to, exceeds, equals or exceeds, is less than, or is less than or equal to, a certain threshold value. The following illustrates a possible format of such a rule:

entry <rulename> {

-   -   IF {ratio <counterNameA> <counterNameB> REL_OPER         .countThreshold>;     -   period {interval};     -   min-value {min-value};     -   hysteresis {hysteresis};     -   }     -   THEN {         -   <actionListIf>;     -   } ELSE {         -   {actionListElse};     -   }

}

where

<ruleName> is the rule name;

<counterNameA> is the name of a counter from which the cumulative count of packet type A is obtained since the last execution of the rule. The cumulative count of packet type A forms the dividend of the ratio;

<counterNameB> is the name of a counter from which the cumulative count of packet type B is obtained since the last execution of the rule. The cumulative count of packet type B forms the divisor of the ratio;

<counterThreshold> is the threshold that is compared to the ratio (contents of counter A divided by the contents of counter B);

REL_OPER is a relational operator, i.e., ==, !=, >, >=, <, or <=;

{interval} is an optional evaluation interval in seconds defining the time period over which the execution of the rule is repeated. For example, a value of 10 specifies that, every 10 seconds, the rule is executed by comparing the ratio of the contents of <counterNameA> and the contents of <counterNameB> with the indicated threshold;

{min-value} is an optional minimum value of both the counter A and B contents before these values are considered valid. If either the counter A or counter B values, forming the dividend and divisor, respectively, is below the specified minimum value, the logical expression forming the subject of the IF statement is declared logically false. If not specified, a default value may be used;

{hysteresis} is an optional hysteresis value. Once the logical expression within the IF statement is true, the new threshold is adjusted with the hysteresis value. For > and >= expressions, the new threshold becomes (<countThreshold>−{hysteresis}). For < and <= expressions, the new threshold becomes (<countThreshold>+{hysteresis}). If {hysteresis} is greater than <countThreshold>, {hysteresis} is set to zero;

<actionListIf> is a list of one or more actions to be performed if the logical expression forming the subject of the IF statement is logically true; and

<actionListElse> is an optional list of one or more actions to be performed if the logical expression forming the subject of the IF statement is logically false.

In the following example of this particular rule format, the counter counter1 is incremented whenever a UDP packet is encountered, and the counter counter2 is incremented whenever a TCP packet is encountered. The counter1 and counter2 values are evaluated every 2 seconds. If both counter values exceed the minimum valid threshold of 1,000, and the ratio of counter1 to counter2 exceeds 5, a message is logged to the message server alerting the network administrator to the situation. In the message string, the $ruleName, $ruleValue, and $ruleThreshold keywords are variables that are replaced with the actual values when the message is logged. Otherwise, no action is performed.

entry rule1 {

-   -   IF {         -   protocol udp;     -   } THEN {         -   count counter1;     -   }

}

entry rule2 {

-   -   IF {         -   protocol tcp;     -   } THEN {         -   count counter2;     -   }

}

entry ratio_rule_example {

-   -   IF {ratio counter1 counter2>5;         -   period 2;         -   min-value 1000;         -   }         -   THEN {             -   syslog “Rule $ruleName threshold ratio $ruleValue                 exceeds limit $ruleThreshold” INFO;         -   }

}

A fourth example is a rule that specifies one or more actions to be taken if a ratio of packet rates, each comprising a rate at which a particular type of packet is received at one or more ingress ports or VLANs or transmitted from one or more egress ports or VLANs, exceeds, equals or exceeds, is equal to, not equal to, less than, or is less than or equal to, a certain threshold value. The following illustrates a possible format of such a rule:

entry <rulename> {

-   -   IF {delta-ratio <counterNameA> <counterNameB> REL_OPER         .countThreshold>;     -   period {interval};     -   min-value {min-value};     -   hysteresis {hysteresis};     -   }     -   THEN {         -   <actionListIf™;     -   } ELSE {         -   {actionListElse};     -   }

}

where

<ruleName> is the rule name;

<counterNameA> is the name of a counter from which the change in packet count of packet type A is obtained since the last execution of the rule. The change in packet count of packet type A forms the dividend of the ratio;

<counterNameB> is the name of a counter from which the change in packet count of packet type B is obtained since the last execution of the rule. The change in packet count of packet type B forms the divisor of the ratio;

<counterThreshold> is the threshold that is compared to the ratio (change in contents of counter A divided by the change in contents of counter B);

REL_OPER is a relational operator, i.e., ==, !=, >, >=, <, or <=;

{interval} is an optional evaluation interval in seconds defining the time period over which the execution of the rule is repeated. For example, a value of 10 specifies that, every 10 seconds, the rule is executed by comparing the ratio of the change in contents of <counterNameA> and the change in contents of <counterNameB> with the indicated threshold;

{min-value} is an optional minimum value of both the change in counter A and B contents before these values are considered valid. If the change in the contents of either the counter A or counter B values, forming the dividend and divisor, respectively, is below the specified minimum value, the logical expression forming the subject of the IF statement is declared logically false. If not specified, a default value may be used;

{hysteresis} is an optional hysteresis value. Once the logical expression within the IF statement is true, the new threshold is adjusted with the hysteresis value. For > and >= expressions, the new threshold becomes (<countThreshold>−{hysteresis}). For < and <= expressions, the new threshold becomes (<countThreshold>+{hysteresis}). If {hysteresis} is greater than <countThreshold>, {hysteresis} is set to zero;

<actionListIf> is a list of one or more actions to be performed if the logical expression forming the subject of the IF statement is logically true; and

<actionListElse> is an optional list of one or more actions to be performed if the logical expression forming the subject of the IF statement is logically false.

In the following example of this particular rule format, the tcpSynCounter is incremented whenever a TCP SYN packet is encountered, and tcpCounter values is incremented whenever a general TCP packet is encountered. Both counters are evaluated every 2 seconds. At that time, the change (delta) in each counter over the previous 2 seconds is computed. If both counter values exceed the minimum valid threshold of 100, and the ratio of the change in tcpSynCounter to that in tcpCounter exceeds 10, indicating the onset of a TCP SYN Flood, then a warning message is logged onto the message server (after the variable $port is replaced with its actual value), and all SYN traffic is denied access to the specified switch port. As no “period” value for the syslog message is specified, the message is only logged once. If the ratio of the change in the two counters subsequently falls below 10 (the ratio must fall below 8 because a hysteresis value of 2 is specified), another message is logged (again after making the variable substitution) indicating this, and access to the specified port by SYN traffic re-enabled.

entry syn {

-   -   IF {         -   tcp_flags SYN;     -   } THEN {         -   count tcpSynCounter;     -   }

}

entry tcp {

-   -   IF {         -   protocol tcp;     -   } THEN {         -   count tcpCounter;     -   }

}

entry delta_ratio_rule_example {

-   -   IF {delta-ratio tcpSynCounter tcpCounter>10;         -   period 2;         -   min-value 100;         -   hysteresis 2;         -   }         -   THEN {             -   syslog “Syn attack on port $port is detected” WARN;             -   deny syn;         -   } ELSE {             -   syslog “Syn attack on port $port is no longer detected”                 WARN;             -   permit syn;         -   }

}

A fifth example is a rule that specifies one or more actions to be taken if a “true” count from another rule, i.e., a count of the number of logical condition(s) specified in the IF portion of the other rule that are satisfied, equals, is not equal to, exceeds, equals or exceeds, is less than, or is less than or equal to, a certain threshold value. The following illustrates a possible format of such a rule:

entry <rulename> {

-   -   IF {rule-true-count <name> REL_OPER <countThreshold>;         -   }     -   THEN {         -   <acfionListIf>;     -   } ELSE {         -   {actionListElse};     -   }

}

where

<ruleName> is the rule name;

<name> is the name of a previous rule;

<counterThreshold> is the threshold that is compared to the true count from the previous rule;

REL_OPER is a relational operator, i.e., ==, !=, >, >=, <, or <=;

<actionListIf> is a list of one or more actions to be performed if the logical expression forming the subject of the IF statement is logically true; and

<actionListElse> is an optional list of one or more actions to be performed if the logical expression forming the subject of the IF statement is logically false.

And example of this particular rule is as follows:

entry rule1 {

-   -   IF {count counter1>10000;         -   count counter2>10000;         -   count counter3>10000;         -   count counter4>10000;         -   }         -   THEN {             -   ;         -   }

}

entry rule2 {

-   -   IF {count counter5>10000;         -   count counter4>10000;         -   rule-true-count rule 1>=1;         -   }         -   THEN {             -   ;             -   }

}

Note that this rule, rule2, is equivalent to the following:

IF{

-   -   counter1>10000;     -   counter2>10000;     -   counter3>10000;     -   counter4>10000;     -   counter5>10000;     -   counter6>10000

}

-   -   THEN {         -   ;         -   }

The one or more actions that may be taken within either the THEN or ELSE portions of the foregoing rules are diverse, and include either starting or stopping packet mirroring to a port accessible by a network administrator. In one implementation, such actions may be specified by the following syntax:

mirror [add/delete] <RuleName>

where “add” specifies that mirroring is to be started while “delete” indicates it is to be stopped, and <RuleName> identifies the rule that defines the profile of the packets that are to be mirrored or not. For example, the command “mirror add rule1” mirrors packets having the packet profile defined by rule1, while the command “mirror delete rule2” turns off mirroring of packets having the packet profile defined by rule2.

The one or more actions may also include starting or stopping redirecting packets to a port accessible by a network administrator.

These actions may further include reconfiguring the switch, such as by disabling one or more ports or deleting one or more ports from a VLAN. In one implementation, such actions are specified using a command line interface (CLI) command having the following syntax:

cli <cliCommand>

where <cliCommand> is a CLI command such as the following “configure” command:

-   -   configure access-list <ruleName> {ports <portlist>|vlan         <vlanName>|any} {direction}

This command applies the identified rule <ruleName> to the ports of the switch identified in <portlist>, to the VLAN specified by <vlanName>, or all ports of the switch if the term “any” is present. The value <direction> indicates whether the rule is to be applied to ingress ports or VLANs, or egress ports or VLANs. If neither is specified, the default value {ingress} is assumed.

Another example is the following “unconfigure” command:

-   -   unconfigure access-list <ruleName> {ports <portlist>|vlan         <vlanName>|any} {direction}         which removes application of the rule <ruleName> from the ports         identified in <portlist>, the VLAN identified by <vlanName>, or         all ports if the term “any” is specified. The value <direction>         specifies whether application of the rule is removed from         ingress ports or VLANs, or egress ports or VLANs. If neither is         specified, the default value {ingress} is assumed.

A third example is the following “refresh” command:

refresh policy <ruleName>

which “refreshes” the indicated rule by resetting the contents of the counter specified by the rule to 0.

A fourth example is the following “configure mirroring add” command:

configure mirroring add [port <port>|vlan <vlanName>]

which mirrors packets received at the identified ingress port(s) or VLAN.

A fifth example is the following global “add/delete mirroring” command:

[disable|enable] mirror

where “disable mirror” disables mirroring on a global basis, and “enable mirror” enables mirroring on a global basis.

A sixth example is the following “disable/enable ports” command:

[disable|enable] ports <portlist>

where “disable ports” disables the ports identified in <portList> and “enable ports” enables these ports.

The one or more actions may also include sending one or more trap messages to a trap server accessible by a network administrator, such as a SNMP trap server. An action such as this may be specified by the following syntax:

snmptrap <id> <message> {period}

which specifies periodically sending the specified message <message> to a SNMP server (along with the code <id>) at a periodicity of {period} seconds. If {period} is 0, the message is sent only once, and if {period} is not specified, a default value of 0 is assumed. For example, snmptrap 100 “TCP SYN flood attack is detected” 30 sends the specified message to the SNMP trap server every 30 seconds.

The one or more actions may also include logging one or more messages to a file or message server accessible by a network administrator. In one example, such an action is specified by the following syntax:

syslog <message> <level> {period}

which specifies periodically logging the specified message <message> to the message server at a periodicity of {period} seconds (which should be an integer multiple of {integer}, the periodicity of the underlying rule). If the value {period} is not specified, a default value of 0 is assumed, indicating that the message is logged only once. The string <level> is a priority indicator that can take on any of the following values: DEBU, INFO, NOTI, WARN, ERRO, or CRIT, where DEBU indicates the message string relates to a debugging operation; INFO, that the string is informational, NOTI, that the string is an important notification to the network administrator, WARN, that the message is a warning, ERRO, that an error has been encountered, and CRIT, that the condition of the network switch is critical.

In one implementation, the message strings of the messages that are sent to the trap server or logged to the message server may include one or more variables that are replaced by underlying data values when the actions are performed. For example, the variable $port in a message string is replaced by the current ingress port when the message is logged or sent. In one example, the following variables may be used within the message string:

-   -   $policyName—replace with policy name     -   $ruleName—replace with rule name     -   $<counterName>—replace with contents of counter with indicated         counter name <counterName>     -   $ruleValue—replace with result, TRUE or FALSE, of logical         expression associated with current rule     -   $ruleThreshold—replace with the threshold associated with         current rule     -   $ruleInterval—replace with the sampling/evaluation interval of         current rule     -   $vlanName—replace with the VLAN name to which the policy is         assigned     -   $port—replace with the port where the policy is applied

The one or more conditions (or any thresholds used in formulating these conditions) within the IF portion of a rule may also include any of the foregoing variables to allow rule triggering based on dynamically changing conditions within the network switch. Alternatively, the one or more conditions (or any thresholds therein) may be predetermined.

The one or more actions within either the THEN or ELSE portions of the rule may also include any of the foregoing variables to allow the actions to be taken if the logical conditions are satisfied or not to be dynamically changed based on network conditions. Alternatively, the one or more actions specified in either the THEN or ELSE portions of the rule may be predetermined.

The one or more actions may also include modifying one or more existing rules that are already applicable to the switch. In one example, actions such as this is specified by the following syntax:

deny <ruleName>

permit <ruleName>

where “deny” changes the indicated rule <ruleName> so that packets meeting the packet profile defined in that rule are denied network access, while “permit” changes the indicated rule <ruleName> so that packets meeting the profile defined in that rule are permitted network access.

The one or more actions may also include applying one or more additional rules to the switch (using the previously discussed “configure” command for example).

They may further include changing the assigned QoS profile assigned to a particular packet. In one example, an action such as this is performed using the following syntax:

qosprofile <ruleName> <QPx>

which specified assigning packets meeting the profile defined in <ruleName> with the QoS value <QPx>.

The rule structure may also support a nesting feature, whereby individual rules may be nested together to define more complex triggering conditions. The following example illustrates a nested rule structure, whereby, among other conditions, rule3 is only triggered when the logical expression defined by the IF portion of rule2 is satisfied:

entry rule1 {

-   -   IF {         -   destination-address 192.168.16.0/24;         -   destination-port 2049;     -   }         -   THEN {count counter1}

entry rule2 {

-   -   IF {count counter1>1000000}         -   THEN {deny rule1}

entry rule3 {

-   -   IF {count counter1<2000000;         -   rule2=TRUE;         -   }         -   THEN {             -   permit rule1;             -   mirror rule1;             -   }                 As the rules are executed sequentially, rule3 overrides                 rule2 by permitting access to those packets nominally                 subject to rule2 when the contents of counter1 is less                 than 2,000,000. The net result is that packets meeting                 the profile specified in rule1 are denied access if the                 cumulative number of these packets received at the                 switch is greater than or equal to 2,000,000, but, if                 the cumulative number of such packets received at the                 switch is greater than 1,000,000 but less than                 2,000,000, the packets are permitted access (but                 mirrored to a network administrator).

The rule structure may also support “match any” and “match all” formats, which are formats designed to handle compound expressions. The “match any” format triggers a rule whenever any one of many logical conditions are satisfied, while the “match all” format triggers the rule only when all the logical conditions are satisfied. In the following example of the “match any” format, the rule is triggered if either the contents of <counter1> or <content2> exceeds 10,000:

entry match any or_rule {

-   -   IF {         -   count counter1>10000;         -   count counter2>10000;         -   }         -   THEN {one or more specified actions}

}

In the following example of the “match all” format, however, the rule is triggered if the contents of <counter1> exceed 10,000 and the contents of <counter2> exceed 10,000:

entry match all and_rule {

-   -   IF {         -   count counter1>10000;         -   count counter2>10000;         -   }         -   THEN {one or more specified actions}

}

In one example if neither format is specified, the “match all” format is assumed.

The rule structure may also support fractional thresholds, i.e., a threshold expressed as a fraction. The following example illustrates the use of a fractional threshold:

entry fraction {

-   -   IF {ratio counter1 counter2>1/1000;     -   }         -   THEN {         -   <one or more specified actions>;             -   }

}.

The rule structure may also support global rules, which are rules applicable to all interfaces, i.e., ports or VLANs, within a particular grouping known as a “policy.” In the following example, a global rule, global_rule, is applied to all interfaces within a particular policy. The rule is designed to detect if there is a SYN attack at any of the ports within the policy. In this example, a SYN attack is defined as the condition where, over a 2 second period, the change in the number of SYN packets exceeds the change in the number of TCP packets by over a factor of 10. If a SYN attack is detected, a second rule, syn_attack, is applied to determine the specific port that is under attack:

entry syn {

-   -   IF {         -   protocol tcp_flags SYN;     -   }THEN {         -   count tcpSynCounter;     -   }

}

entry tcp {

-   -   IF {         -   protocol tcp;     -   }THEN {         -   count tcpCounter;     -   }

}

entry global_rule {

-   -   IF {delta-ratio tcpSynCounter tcpCounter>10;         -   global;         -   period 2;         -   min-value 100;         -   hysteresis 2;         -   }         -   THEN {             -   syslog “Syn attack is detected” WARN;         -   }

}

entry syn_attack {

-   -   IF {delta tcpSynCounter>100;         -   global_rule=TRUE; #Now we can find out which port is under             attack         -   period 2;         -   hysteresis 2;         -   }         -   THEN {             -   syslog “Syn attack on port $port is detected” WARN             -   deny syn;         -   }ELSE {             -   syslog “Syn attack on port $port is no longer detected”

WARN;

-   -   permit syn;     -   }

}

The rule structure may also support a “byte” option, which allows counters that normally function as packet counters to also function as byte counters. The following example demonstrates the use of the byte option in a rule designed to detect the onset of a particular network attack characterized by large average size ping packets:

entry icmp {

-   -   IF {         -   protocol icmp;     -   } THEN {         -   count PingCount;     -   }

}

entry ping_of death {

-   -   IF {ratio-delta pingCount.byte pingCount>1000; #large size ping         -   }         -   THEN {         -   <one or more specified actions>;         -   }     -   }

The rule structure may also support an “average” option, which allows averages to be taken over a defined sampling period. In the following example, through use of the “average” option, the rule specified one or more specified actions to be performed if the average change in the pingCount over 10 samples is greater than 2,000:

entry icmp {

-   -   IF {         -   protocol icmp;     -   } THEN {         -   count pingCount;     -   }

}

entry average {

-   -   IF {delta pingCount>2000;     -   average 10; # average for 10 samples     -   }         -   THEN {         -   <one or more specified actions>;             -   }

}.

The rule structure may also support a “time” feature, whereby the time period during which one or more of the conditions must be satisfied may be specified. In the following example, this “time” feature is used to specify a threshold of 1,000,000 that is applicable only during business hours (9 AM-5 PM):

entry rule1 {

-   -   IF {         -   destination-address 192.168.16.0/24;         -   destination-port 2049;     -   }         -   THEN {count counter1}

entry rule2 {

-   -   IF {         -   count counter1>1000000;         -   time within 9 AM and 5 PM;     -   }         -   THEN {deny rule1}             Assuming the threshold of 1,000,000 represents quota             applicable to the user, this example enforces the quota by             denying access during business hours to a user exceeding the             quota, but allowing the user access outside of business             hours.

In the following example, this “time” feature is used to specify thresholds that vary depending on time of day, with a threshold of 1,000,000 applicable during business hours (9 AM-5 PM) and a threshold of 2,000,000 applicable outside of business hours:

entry rule1 {

-   -   IF {         -   destination-address 192.168.16.0/24;         -   destination-port 2049;     -   }         -   THEN {count counter1}

entry rule2 {

-   -   IF {         -   count counter1>1000000;         -   time within 9 AM and 5 PM;     -   }         -   THEN {deny rule1}

entry rule3 {

-   -   IF {         -   count counter1>2000000;         -   time outside 9 AM and 5 PM;     -   }         -   THEN {deny rule1}

The rule structure allows one or more rules embodying any of the methods illustrated in FIGS. 1-3 to be formulated and then realized on a particular switch by downloading them to the switch, and then arranging to have one or more processors at the switch compile the rules into executable form (if not already in that form) and execute the rules on an ongoing basis as packets are received at the switch. In this section, examples of rules embodying the methods of FIGS. 1-3 are presented and discussed. Examples of rules embodying on-switch methods of enforcing policies relating to network switch resources are presented first, followed by examples of rules embodying on-switch methods of detecting and mitigating network anomalies, followed by examples of rules embodying on-switch methods of selectively filtering packets to an externally-accessible port.

5. Examples of Rules Embodying Methods of Enforcing Policies Relating to One or More Network Switch Resources

The following rule embodies a method of enforcing a user traffic quota by monitoring the total byte count of packets received from (or transmitted by) the user, and, if the quota is exceeded, blocking the traffic and sending a notification to the network administrator to inform him of the situation:

entry monthly_traffic_limit_(—)10.0.0.x {

-   -   IF {count bytes_(—)10.0.0.x>quota; # Limit 16 MB if         quota=16777216         -   } THEN {         -   snmptrap 1 “Traffic on network 10.0.0.x has exceeded monthly             quota”;         -   deny rule_(—)10.0.0.x;     -   } ELSE {         -   permit rule_(—)10.0.0.x; # Allow traffic again if quota is             increased             -   # Or monthly traffic counter is reset}     -   }

}

The ELSE clause restores access by the user once the quota is increased or the monthly traffic counter increased.

The following rule monitors a user's bandwidth consumption, and, if that consumption exceeds a threshold, a QoS profile reflective of a lower packet priority is assigned to the user's traffic:

entry traffic_rate_limit_(—)10.1.0.x {

-   -   IF {rate bytes_(—)10.1.0.x>rate_limit; # Limit 1 MB per second         if rate_limit=1048576

period 1; # Sample and evaluate once every second

} THEN {

qosprofile rule_(—)10.1.0.x QP0; # Place traffic to lowest queue

-   -   } ELSE {

qosprofile rule_(—)10.1.0.x QP3; # Restore traffic to normal queue}

-   -   }     -   }

The following rule permits traffic on a guest client only during business hours:

entry guest_(—)10.2.0.x {

IF {time Monday-Friday 7:00 am-6:00 pm; # During business hours

-   -   } THEN {     -   permit rule_(—)10.2.0.x;

} ELSE {

-   -   deny rule_(—)10.2.0.x;     -   }

}

6. Examples of Rules Embodying on-Switch Methods of Detecting and Mitigating Network Anomalies

The following rule detects and mitigates a particular form of denial of service (DOS) attack known as a TCP SYN-ACK Flood, whereby the network is beset with a flood of TCP packets with the SYN-ACK flag set. The rule counts the number of SYN-ACK packets and monitors the SYN-ACK packet rate. If the rate exceeds a particular threshold, indicating that a flood condition is present, the rule responds by logging a message alerting the network administrator to the situation, and disabling the ingress port:

entry tcp_syn-ack_attack {

-   -   IF {rate tcpSynAckCount>5000; # High rate of syn-ack packets

} THEN {

syslog “SYN-ACK attack is detected on port $port” WARN;

CLI “disable port $port”; # Disable port under attack

-   -   }     -   }

The following rule detects and mitigates another form of DOS attack known as a Ping of Death attack. In this particular form of attack, ping packets having large frame sizes flood the network, causing a Denial of Service condition on the input buffer of the target host:

entry ping_of death {

-   -   IF {rate-ratio pingByteCount pingCount>1500; # Large ping packet         size

} THEN {

syslog “Ping of death is detected on port $port” WARN;

}

-   -   }

Some classes of viruses and worms exhibit signatures, such as attacking a specific IP port, sending packets with a specific length or specific information in the IP header, creating excessive network traffic, or any combination of the foregoing. For example, the W32.5QLExp.Worm, commonly known as the Slammer worm, sends an excessive amount of 376-byte packets to UDP port 1434. The following rule detects packets having this signature, and, in response, blocks all such traffic:

entry W32.5QLExp.Worm {

-   -   IF {rate counter_(—)376 Byte_UDP-1434>2000;

} THEN {

snmptrap 2 “Slammer worm detected on port $port”;

deny rule_(—)376 Byte_UDP-1434;

-   -   } ELSE {

snmptrap 3 “Slammer worm no longer detected on port $port”;

permit rule_(—)376 Byte_UDP-1434;

-   -   }     -   }

Excessive email traffic may indicate a worm that is propagating itself by sending out email, or an infected host sending out spam email. The following rule detects excessive email traffic such as that generated by a mass-email worm and, in response, alerts the network administrator and mirrors the suspicious traffic to a CPU for further analysis:

entry email_traffic {

-   -   IF {rate emailCount>5000; # Abnormally high email traffic rate         -   } THEN {         -   # Send a trap to alert the network administrator         -   snmptrap 4 “Excessive email traffic ($currentValue) detected             on $port”;         -   # Mirror traffic for further analysis         -   mirror add email to-cpu;     -   } ELSE {         -   snmptrap 5 “Email traffic ($currentValue) on $port falls             below threshold”;         -   mirror delete email;     -   }

}

Once the condition has abated (determined when the rate of the traffic falls below the threshold), another message is sent to the network administrator indicating this, and mirroring is stopped.

The following rule monitors utilization of a particular port (ingress or egress) by a certain application, and, if this utilization exceeds a threshold, indicating the link is about to become overloaded, alerts the network administrator to address the problem before traffic is dropped due to over-subscription of the link:

entry port_utilization {

IF {rate portCount>1339285; # Average utilization rate on Gig port is greater 90%

-   -   period 1800; # Monitor every half an hour     -   } THEN {     -   # Send a trap to alert the network administrator     -   snmptrap 6 “Traffic on $port approaching maximum utilization”;     -   }

}

The following rule alerts the network administrator to excessive ARP traffic on the network:

entry arp_rate {

-   -   IF {rate arpCount>1000; # Notify if arp rate is greater than         1000 pps

} THEN {

# Send a trap to alert the network administrator

snmptrap 7 “Arp traffic rate on Sport is $currentValue”;

-   -   }     -   }

The following rule alerts the network administrator if there is excessive ping traffic on the network:

entry icmp_rate {

-   -   IF {rate icmpCount>5000; # Notify if ping rate is greater than         5000 pps

} THEN {

# Send a trap to alert the network administrator

snmptrap 8 “Icmp rate ($currentValue) on $port exceeds threshold”;

-   -   } ELSE {

# Notify again when it falls below threshold

snmptrap 9 “Icmp rate ($currentValue) on $port falls below threshold”;

-   -   }     -   }         Once the ping traffic has fallen below the threshold, the rule         dynamically responds by alerting the network administrator to         this.

7. Examples of Rules Embodying on-Switch Methods of Selectively Filtering Packets to an Externally-Accessible Port

The following rule is a rate-ratio triggered rule that mirrors ping traffic to the external port only when the rate-ratio exceeds a threshold:

entry ping_of death {

-   -   IF {rate-ratio pingByteCount pingCount>1500; # Large ping packet         size

} THEN {

mirror add ping to-port 8:1; # Mirror traffic to an external appliance on port 8:1

-   -   } ELSE {

minor delete ping; # No more attack detect, stop minor traffic

-   -   }     -   }         If the rate-ratio subsequently falls below the threshold, the         rule dynamically responds by ceasing the mirroring of the         packets.

The following rule is a rate-triggered rule that mirrors traffic to the external port only when the rate of utilization of a particular port exceeds a threshold:

entry port_utilization {

-   -   IF {rate portCount>3*averagePortUtilization; # Abnormal port         utilization period 300; # Monitor every 5 minutes         -   } THEN {         -   # Encapsulate and mirror traffic to an external appliance             listening on UDP port 5000             -   mirror add port Sport to-client 192.168.2.245:5000;         -   }     -   }

The following rule is a rate-triggered rule that mirrors ICMP traffic to the external port only when the rate exceeds a threshold:

entry icmp_rate {

-   -   IF {rate icmpCount>5000; # Notify if ping rate is greater than         5000 pps

hysteresis 2000;

period 2;

} THEN {

mirror add icmp to-port 8:1;

-   -   } ELSE {

mirror delete icmp;

-   -   }     -   }         Again, if the ICMP traffic rate subsequently falls below the         threshold, the rule dynamically responds by ceasing the         mirroring of this traffic.

The following rule is a rate-triggered rule that mirrors email traffic to the external port only when the rate exceeds a threshold:

entry email_traffic {

-   -   IF {rate emailCount>5000; # Abnormally high email traffic rate

} THEN {

mirror add email to-port 8:1;

-   -   } ELSE {

mirror delete email;

-   -   }     -   }         Once again, if the email traffic rate subsequently falls below         the threshold, the rule dynamically responds by ceasing the         mirroring of this traffic.

8. Systems for Performing One or More Network Switch Functions Responsive to One or More Rules

Turning back to FIG. 4, the one or more processor readable media 400 holding the one or more rules 402 a, 402 b, 402 c may be part of a system. FIG. 5 illustrates an embodiment 500 of such a system that is configured for performing one or more network switch functions by or for network switch 508. In this embodiment, the system comprises the one or more processor readable media 400 of FIG. 4, holding the one or more rules 402 a, 402 b, 402 c embodying any of the previously described methods, including those illustrated in FIGS. 1-3, and one or processors 506 for accessing the one or more rules 402 a, 402 b, 402 c from the one or more processor readable media 400, compiling them if necessary, and executing them as packets are received so as to perform the one or more network switch functions. The network switch 508 has one or more ports of ingress 510 and one or more ports of egress 512. The network switch 508 is shown in phantom as it may or may not be part of the system.

In one implementation, the one or more processors 506 are configured to compile the one or more rules into executable form, and then execute the one or more rules to perform the one or more network switch functions. In this implementation, the network administrator also specifies one or more ports a rule is applicable to (as well as the port direction, whether ingress or egress), one or more VLANs a rule is applicable to, or whether the rule is a wildcard rule applicable to all ports. such as through the CLI “configure” command (discussed previously). To remove application of a rule from one or more ports or VLANs, the network administrator in this implementation may input the previously-discussed CLI “unconfigure” command over a user interface.

The rules may be executed once or more than once, although in practice, they will normally be executed on an ongoing basis as packets are received at or transmitted from the switch. In one implementation, the rules are executed periodically at the level of periodicity specified in the rules, which may differ amongst the rules.

A priority resolution scheme may also be employed to resolve conflicts between rules. In one approach, the priority resolution scheme gives highest priority to rules applicable to specific ports, the next highest priority to rules applicable to specific VLANs, and the lowest priority to wildcard rules applicable to all ports. For example, if a particular rule, rule1, is applied to port A that is part of VLAN B, and a second conflicting rule, rule 2, is applied to VLAN B, then rule1 will take priority over rule2 as to port A, and rule 2 will be inapplicable to port A.

In the system 500, the one or more processors 506 may form at least a portion of or be integral with the network switch 508, while, in another, they are distinct from but coupled to the network switch 508. In one example, the one or more processors 506 are implemented as one or more ASICs.

In one embodiment, the network switch 508 includes one or more externally-accessible ports 514 accessible by a network administrator to which mirrored packets may be directed. The port 514 may be coupled to a remote client or CPU 516 through which the network administrator gains access to the mirrored packets, or the port 514 may be a monitor port through which the network administrator gains access to the mirrored packets.

The network switch 508 may also be coupled to a trap server 518 accessible by the network administrator to which traps (interrupts) or trap messages may be sent responsive to execution of the rules. In one example, the server 518 is a SNMP server for the receipt of SNMP traps and trap messages.

The network switch 508 may also be coupled to a server 520 for the receipt of messages logged to the server (or a file within the server) in response to the execution of one or more rules. The server 520 may be distinct from the server 518 or the two may be implemented as the same server.

The network switch 508 may also be configured with a user interface 522 for the receipt of rules and CLI commands from a network administrator for applying the rules to specific ports or VLANs of the network switch. The user interface 522 may also be configured to display reports showing the status of the various rules, including reports illustrating which rules apply to which ports and VLANs.

The one or more processors 506 may be coupled to one or more processor readable media 524 on which is stored a compiler 526 for compiling the one or more rules 402 a, 402 b, 402 c and putting them into executable form. The one or more processor readable media 524 storing the compiler may be distinct from the one or more media 400 storing the one or more rules 402 a, 402 b, 402 c. or the two may be the same one or more media.

The rules may also be embodied in hardware or combinations of hardware and software. In one implementation, the system comprises logic tangibly embodying one or more rules, the one or more rules embodying any of the previously-described methods, including those illustrated in FIGS. 1-3.

9. Applications of the Rules to Edge, Non-Gateway Switches

The foregoing rules may be applied to gateway switches as well as edge, non-gateway switches within a particular subnet. While application to gateway switches protects against external threats, application to one or more (if not all) edge, non-gateway switches protects against internally-generated network threats. FIG. 6 illustrates an embodiment 600 of a system comprising one or more non-gateway switches 602 a, 602 b, 602 c, 602 d, 602 e that are interconnected to form a subnet 604 that is coupled to one or more other subnets 608, 610 through one or more gateway switches or servers 606 a, 606 b. One or more of the internal, non-gateway switches 602 a, 602 b, 602 c, 602 d, 602 e within the subnet 604 include a means (such as the one or more processor readable media 400 of FIG. 4 and one or more processors for accessing and executing the rules stored thereon, or logic embodying the rules and other logic for executing the rules) for performing any of the previously described methods, including the methods illustrated in FIGS. 1-3.

While various embodiments of the invention have been described, it will be apparent to those of ordinary skill in the art that many more embodiments and implementations are possible that are within the scope of this invention. 

1. A system, integrated with or coupled to a network switch having a plurality of ports, for applying one or more policies to selected ports of the switch, comprising: a user interface for receiving user input, for each of the one or more policies, comprising one or more structured rules for implementing the policy, and user selection of any one or more of the plurality of ports for application of the one or more structured rules; one or more processor readable media for holding, for each of the one or more policies, the one or more structured rules for implementing the policy; and one or more processors for accessing, for each of the one or more policies, the one or more structured rules for implementing the policy held by the one or more processor readable media, compiling the one or more structured rules into executable software, and executing the software; wherein, for each of the one or more policies, the one or more structured rules implementing a policy specify: (1) a packet profile; (2) a counter having content; (3) a usage-based packet statistic to be derived from the counter having content; (4) one or more conditions; and (5) one or more actions to be taken if the one or more conditions are met; wherein the one or more processors, for each of the one or more policies, execute the software compiled from the one or more structured rules implementing the policy, thus applying the policy to the selected ports of the switch by performing the following steps: (1) updating the counter having content as packets that match a specified profile are transmitted from the selected one or more ports; (2) deriving the usage-based packet statistic from the updated counter contents; (3) checking whether the usage-based packet statistic satisfies the one or more conditions; and (4) taking the one or more actions if the usage-based packet statistic meets the one or more conditions.
 2. A system, integrated with or coupled to a network switch having a plurality of ports, for applying one or more policies to selected ports of the switch, comprising: a user interface for receiving user input, for each of the one or more policies, comprising one or more structured rules for implementing the policy, and user selection of any one or more of the plurality of ports for application of the one or more structured rules; one or more processor readable media for holding, for each of the one or more policies, the one or more structured rules for implementing the policy; and one or more processors for accessing, for each of the one or more policies, the one or more structured rules for implementing the policy held by the one or more processor readable media, compiling the one or more structured rules into executable software, and executing the software; wherein, for each policy, the one or more structured rules implementing a policy specify: (1) a first packet profile; (2) a first counter having content; (3) a second packet profile; (4) a second counter having content; (5) a usage-based packet statistic to be derived from the first and second counter having content; (6) one or more conditions; and (7) one or more actions to be taken if the one or more conditions are met; wherein the one or more processors, for each of the one or more policies, execute the software compiled from the one or more structured rules implementing the policy, thus applying the policy to the selected ports of the switch by performing the following steps: (1) updating the first counter contents as packets that match a specified profile are transmitted from the selected one or more ports; (2) updating the second counter contents as packets that match a specified profile are transmitted from the selected one or more ports; (3) deriving the usage-based packet statistic from the updated first and second counter contents; (4) checking whether the usage-based packet statistic satisfies the one or more conditions; and (5) taking the one or more actions if the usage-based packet statistic meets the one or more conditions.
 3. The system of claim 1 wherein the user interface is further configured to allow the user to select, for a policy, a packet flow direction.
 4. The system of claim 3 wherein, when the selected packet flow direction for the policy is ingress, the one or more processors, when executing the software compiled from the one or more structured rules implementing the policy, update the counter contents as packets matching the specified profile are received at the selected one or more ports.
 5. The system of claim 3 wherein, when the selected packet flow direction for the policy is egress, the one or more processors, when executing the software compiled from the one or more structured rules implementing the policy, update the counter contents as packets matching the specified profile are transmitted from the selected one or more ports.
 6. The system of claim 3 wherein, when the user does not select a packet flow direction for the policy through the user interface, the system applies a default selection for that policy, wherein the packet flow direction is either ingress or egress.
 7. The system of claim 6 wherein the default selection is ingress.
 8. The system of claim 2 wherein the user interface is further configured to allow the user to select, for a policy, a packet flow direction.
 9. The system of claim 8 wherein, when the selected packet flow direction for the policy is ingress, the one or more processors, when executing the software compiled from the one or more structured rules implementing the policy, update the first and second counter contents as packets matching the specified profile are received at the selected one or more ports.
 10. The system of claim 8 wherein, when the selected packet flow direction for the policy is egress, the one or more processors, when executing the software compiled from the one or more structured rules implementing the policy, update the first and second counter contents as packets matching the specified profile are transmitted from the selected one or more ports.
 11. The system of claim 8 wherein, when the user does not select a packet flow direction for the policy through the user interface, the system applies a default selection for that policy.
 12. The system of claim 11 wherein the default selection is ingress.
 13. The system of claim 1 wherein the one or more structured rules implementing a policy further specify a repetition time period, and the one or more processors, when executing the software compiled from the one or more structured rules implementing the policy, repeats steps (2), (3) and (4) at a frequency determined by the repetition time period.
 14. The system of claim 2 wherein the one or more structured rules implanting a policy further specify a repetition time period, and the one or more processors, when executing the software compiled from the one or more structured rules implementing the policy, repeats steps (3), (4) and (5) at a frequency determined by the repetition time period.
 15. The system of claim 1 wherein the network switch is in communication with one or more virtual local area networks (VLANs), and the user interface is further configured to allow a user to select, for a policy, one or more of the VLANs for application of the policy.
 16. The system of claim 15 wherein the user interface is further configured to allow the user to select, for a policy, a packet flow direction.
 17. The system of claim 16 wherein, when the selected packet flow direction for the policy is ingress, the one or more processors, when executing the software compiled from the one or more structured rules implementing the policy, update the counter contents as packets matching the specified profile are received from the selected one or more VLANs.
 18. The system of claim 16 wherein, when the selected packet flow direction for the policy is egress, the one or more processors, when executing the software compiled from the one or more structured rules implementing the policy, update the counter contents as packets matching the specified profile are transmitted to the selected one or more VLANs.
 19. The system of claim 2 wherein the network switch is in communication with one or more virtual local area networks (VLANs), and the user interface is further configured to allow a user to select, for a policy, one or more of the VLANs for application of the policy.
 20. The system of claim 19 wherein the user interface is further configured to allow the user to select, for a policy, a packet flow direction.
 21. The system of claim 20 wherein, when the selected packet flow direction for the policy is ingress, the one or more processors, when executing the software compiled from the one or more structured rules implementing the policy, update the first and second counter contents as packets matching the specified profile are received from the selected one or more VLANs.
 22. The system of claim 20 wherein, when the selected packet flow direction for the policy is egress, the one or more processors, when executing the software compiled from the one or more structured rules implementing the policy, update the counter contents as packets matching the specified profile are transmitted to the selected one or more VLANs.
 23. The system of claim 15 or 19 wherein the one or more processors implement a priority resolution scheme for resolving conflicts, if any that may arise between structured rules applicable to selected ports and rules applicable to selected VLANs that include those ports.
 24. The system of claim 1 or 2 wherein the packet profile specifies one or more conditions to be met by one or more fields of the packet.
 25. The system of claim 1 wherein the counter contents represent a cumulative count of the number of packets matching the packet profile that are received at any of the selected one or more ports.
 26. The system of claim 1 where the counter contents represent a cumulative count of the number of bytes of packets matching the packet profile that are received at any of the selected one or more ports.
 27. The system of claim 2 wherein the first counter contents represent a cumulative count of the number of packets matching the first packet profile that are either received at or transmitted from any of the selected one or more ports, and the second counter contents represent a cumulative count of the number of packets matching the second packet profile that are either received at or transmitted from any of the selected one or more ports.
 28. The system of claim 2 where the first counter contents represent a cumulative count of the number of bytes of packets matching the first packet profile that are either received at or transmitted from any of the selected one or more ports, and the second counter contents represent a cumulative count of the number of bytes of packets matching the second packet profile that are either received at or transmitted from any of the selected one or more ports.
 29. The system of claim 25 wherein the usage-based packet statistic is the cumulative count of the number of packets matching the packet profile that are either received at or transmitted from any of the selected one or more ports.
 30. The system of claim 26 where the usage-based packet statistic is the cumulative count of the number of bytes of packets matching the packet profile that are either received at or transmitted from any of the selected one or more ports.
 31. The system of claim 25 where the usage-based packet statistic is a rate of change of the cumulative count of the number of packets matching the specified profile that are either received at or transmitted from any of the selected one or more ports.
 32. The system of claim 26 wherein the usage-based packet statistic is the rate of change of the cumulative count of the number of bytes of packets matching the specified profile that are either received at or transmitted from any of the selected one or more ports.
 33. The system of claim 27 wherein the usage-based packet statistic is the ratio of the cumulative count of the number of packets matching the first packet profile that are either received at or transmitted from any of the selected one or more ports to the cumulative count of the number of packets matching the second packet profile that are either received at or transmitted from any of the selected one or more ports.
 34. The system of claim 28 where the usage-based packet statistic is the ratio of the cumulative count of the number of bytes of packets matching the first packet profile that are either received at or transmitted from any of the selected one or more ports to the cumulative count of the number of bytes of packets matching the second packet profile that are either received at or transmitted from any of the selected one or more ports.
 35. The system of claim 27 where the usage-based packet statistic is the ratio of the rate of change of the cumulative count of the number of packets matching the first packet profile that are either received at or transmitted from any of the selected one or more ports to a rate of change of the cumulative count of the number of packets matching a second packet profile that are either received at or transmitted from any of the selected one or more ports.
 36. The system of claim 28 wherein the usage-based packet statistic is the ratio of a rate of change of the cumulative count of the number of bytes of packets matching a first packet specified profile that are either received at or transmitted from any of the selected one or more ports to the rate of change of the cumulative count of the number of bytes of packets matching the second packet specified profile that are either received at or transmitted from any of the selected one or more ports.
 37. The system of claim 1 or 2 wherein the one or more conditions comprise the usage-based packet statistic exceeding a predetermined threshold.
 38. The system of claim 1 or 2 wherein the one or more actions comprise denying switch access to packets matching the packet profile that are either received at or transmitted from any of the selected one or more ports.
 39. The system of claim 1 or 2 wherein the one or more actions comprise changing priority of packets matching the packet profile that are either received at or transmitted from any of the selected one or more ports.
 40. The system of claim 1 or 2 wherein the one or more actions comprise sending a trap message to a server accessible by a network administrator.
 41. The system of claim 1 or 2 wherein the one or more actions comprise statistical sampling of every Nth one of packets matching the packet profile that are either received at or transmitted from any of the selected one or more ports.
 42. The system of claim 1 or 2 wherein the one or more actions comprise logging a message to a file or message server accessible by a network administrator.
 43. The system of claim 1 or 2 wherein the one or more actions comprise disabling one or more switch ports.
 44. The system of claim 1 or 2 wherein the one or more actions comprise deleting one or more ports from a virtual local area network (VLAN).
 45. The system of claim 1 or 2 wherein, for at least one of the policies, the one or more rules implementing the policy specify one or more other actions to be taken if the one or more conditions are not satisfied, and the one or more processors, in executing the software compiled from the one or more structured rules, takes these one or more other actions if the one or more conditions are not satisfied.
 46. The system of claim 1 or 2 wherein, for at least one of the policies, the one or more structured rules implementing the policy conforms to an IF-THEN format.
 47. The system of claim 1 or 2 wherein, for at least one of the policies, the one or more structured rules implementing the policy conforms to an IF-THEN-ELSE format. 